Optimal. Leaf size=58 \[ \frac {2 (b+c) \text {ArcTan}\left (\frac {\sqrt {a+b} \tan \left (\frac {x}{2}\right )}{\sqrt {a-b}}\right )}{\sqrt {a-b} \sqrt {a+b}}+\frac {\log (a-b \cos (x))}{b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 58, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {4486, 2738,
211, 2747, 31} \begin {gather*} \frac {2 (b+c) \text {ArcTan}\left (\frac {\sqrt {a+b} \tan \left (\frac {x}{2}\right )}{\sqrt {a-b}}\right )}{\sqrt {a-b} \sqrt {a+b}}+\frac {\log (a-b \cos (x))}{b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 211
Rule 2738
Rule 2747
Rule 4486
Rubi steps
\begin {align*} \int \frac {b+c+\sin (x)}{a-b \cos (x)} \, dx &=\int \left (\frac {-b-c}{-a+b \cos (x)}+\frac {\sin (x)}{a-b \cos (x)}\right ) \, dx\\ &=(-b-c) \int \frac {1}{-a+b \cos (x)} \, dx+\int \frac {\sin (x)}{a-b \cos (x)} \, dx\\ &=\frac {\text {Subst}\left (\int \frac {1}{a+x} \, dx,x,-b \cos (x)\right )}{b}-(2 (b+c)) \text {Subst}\left (\int \frac {1}{-a+b+(-a-b) x^2} \, dx,x,\tan \left (\frac {x}{2}\right )\right )\\ &=\frac {2 (b+c) \tan ^{-1}\left (\frac {\sqrt {a+b} \tan \left (\frac {x}{2}\right )}{\sqrt {a-b}}\right )}{\sqrt {a-b} \sqrt {a+b}}+\frac {\log (a-b \cos (x))}{b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.10, size = 55, normalized size = 0.95 \begin {gather*} -\frac {2 (b+c) \tanh ^{-1}\left (\frac {(a+b) \tan \left (\frac {x}{2}\right )}{\sqrt {-a^2+b^2}}\right )}{\sqrt {-a^2+b^2}}+\frac {\log (a-b \cos (x))}{b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.15, size = 85, normalized size = 1.47
method | result | size |
default | \(\frac {\ln \left (a \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+b \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+a -b \right )+\frac {2 \left (b^{2}+b c \right ) \arctan \left (\frac {\left (a +b \right ) \tan \left (\frac {x}{2}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}}{b}-\frac {\ln \left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )}{b}\) | \(85\) |
risch | \(\frac {i x}{b}-\frac {2 i x \,a^{2} b}{a^{2} b^{2}-b^{4}}+\frac {2 i x \,b^{3}}{a^{2} b^{2}-b^{4}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {-b^{2} a -c a b +i \sqrt {-a^{2} b^{4}-2 b^{3} a^{2} c -b^{2} a^{2} c^{2}+b^{6}+2 b^{5} c +b^{4} c^{2}}}{b^{2} \left (b +c \right )}\right ) a^{2}}{\left (a^{2}-b^{2}\right ) b}-\frac {b \ln \left ({\mathrm e}^{i x}+\frac {-b^{2} a -c a b +i \sqrt {-a^{2} b^{4}-2 b^{3} a^{2} c -b^{2} a^{2} c^{2}+b^{6}+2 b^{5} c +b^{4} c^{2}}}{b^{2} \left (b +c \right )}\right )}{a^{2}-b^{2}}+\frac {\ln \left ({\mathrm e}^{i x}+\frac {-b^{2} a -c a b +i \sqrt {-a^{2} b^{4}-2 b^{3} a^{2} c -b^{2} a^{2} c^{2}+b^{6}+2 b^{5} c +b^{4} c^{2}}}{b^{2} \left (b +c \right )}\right ) \sqrt {-a^{2} b^{4}-2 b^{3} a^{2} c -b^{2} a^{2} c^{2}+b^{6}+2 b^{5} c +b^{4} c^{2}}}{\left (a^{2}-b^{2}\right ) b}+\frac {\ln \left ({\mathrm e}^{i x}-\frac {b^{2} a +c a b +i \sqrt {-a^{2} b^{4}-2 b^{3} a^{2} c -b^{2} a^{2} c^{2}+b^{6}+2 b^{5} c +b^{4} c^{2}}}{b^{2} \left (b +c \right )}\right ) a^{2}}{\left (a^{2}-b^{2}\right ) b}-\frac {b \ln \left ({\mathrm e}^{i x}-\frac {b^{2} a +c a b +i \sqrt {-a^{2} b^{4}-2 b^{3} a^{2} c -b^{2} a^{2} c^{2}+b^{6}+2 b^{5} c +b^{4} c^{2}}}{b^{2} \left (b +c \right )}\right )}{a^{2}-b^{2}}-\frac {\ln \left ({\mathrm e}^{i x}-\frac {b^{2} a +c a b +i \sqrt {-a^{2} b^{4}-2 b^{3} a^{2} c -b^{2} a^{2} c^{2}+b^{6}+2 b^{5} c +b^{4} c^{2}}}{b^{2} \left (b +c \right )}\right ) \sqrt {-a^{2} b^{4}-2 b^{3} a^{2} c -b^{2} a^{2} c^{2}+b^{6}+2 b^{5} c +b^{4} c^{2}}}{\left (a^{2}-b^{2}\right ) b}\) | \(708\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.38, size = 235, normalized size = 4.05 \begin {gather*} \left [-\frac {\sqrt {-a^{2} + b^{2}} {\left (b^{2} + b c\right )} \log \left (-\frac {2 \, a b \cos \left (x\right ) - {\left (2 \, a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (x\right ) - b\right )} \sin \left (x\right ) + a^{2} - 2 \, b^{2}}{b^{2} \cos \left (x\right )^{2} - 2 \, a b \cos \left (x\right ) + a^{2}}\right ) - {\left (a^{2} - b^{2}\right )} \log \left (b^{2} \cos \left (x\right )^{2} - 2 \, a b \cos \left (x\right ) + a^{2}\right )}{2 \, {\left (a^{2} b - b^{3}\right )}}, \frac {2 \, \sqrt {a^{2} - b^{2}} {\left (b^{2} + b c\right )} \arctan \left (-\frac {a \cos \left (x\right ) - b}{\sqrt {a^{2} - b^{2}} \sin \left (x\right )}\right ) + {\left (a^{2} - b^{2}\right )} \log \left (b^{2} \cos \left (x\right )^{2} - 2 \, a b \cos \left (x\right ) + a^{2}\right )}{2 \, {\left (a^{2} b - b^{3}\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 748 vs.
\(2 (49) = 98\).
time = 12.12, size = 748, normalized size = 12.90 \begin {gather*} \begin {cases} \tilde {\infty } \left (- c \log {\left (\tan {\left (\frac {x}{2} \right )} - 1 \right )} + c \log {\left (\tan {\left (\frac {x}{2} \right )} + 1 \right )} - \log {\left (\tan {\left (\frac {x}{2} \right )} - 1 \right )} - \log {\left (\tan {\left (\frac {x}{2} \right )} + 1 \right )} + \log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )}\right ) & \text {for}\: a = 0 \wedge b = 0 \\- \tan {\left (\frac {x}{2} \right )} - \frac {c \tan {\left (\frac {x}{2} \right )}}{b} - \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )}}{b} & \text {for}\: a = - b \\- \frac {1}{\tan {\left (\frac {x}{2} \right )}} - \frac {c}{b \tan {\left (\frac {x}{2} \right )}} - \frac {\log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )}}{b} + \frac {2 \log {\left (\tan {\left (\frac {x}{2} \right )} \right )}}{b} & \text {for}\: a = b \\\frac {c x - \cos {\left (x \right )}}{a} & \text {for}\: b = 0 \\\frac {a \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} \log {\left (- \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} + \frac {a \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} \log {\left (\sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} - \frac {a \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} \log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} + \frac {b^{2} \log {\left (- \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} - \frac {b^{2} \log {\left (\sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} + \frac {b c \log {\left (- \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} - \frac {b c \log {\left (\sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} + \frac {b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} \log {\left (- \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} + \frac {b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} \log {\left (\sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + \tan {\left (\frac {x}{2} \right )} \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} - \frac {b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} \log {\left (\tan ^{2}{\left (\frac {x}{2} \right )} + 1 \right )}}{a b \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}} + b^{2} \sqrt {- \frac {a}{a + b} + \frac {b}{a + b}}} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 103 vs.
\(2 (48) = 96\).
time = 0.48, size = 103, normalized size = 1.78 \begin {gather*} \frac {2 \, {\left (\pi \left \lfloor \frac {x}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a + 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, x\right ) + b \tan \left (\frac {1}{2} \, x\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )} {\left (b + c\right )}}{\sqrt {a^{2} - b^{2}}} + \frac {\log \left (a \tan \left (\frac {1}{2} \, x\right )^{2} + b \tan \left (\frac {1}{2} \, x\right )^{2} + a - b\right )}{b} - \frac {\log \left (\tan \left (\frac {1}{2} \, x\right )^{2} + 1\right )}{b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 11.90, size = 2213, normalized size = 38.16 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________